package com.creditcmsplt.controller;

import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.creditcmsplt.entity.param.RqTest;
import com.creditcmsplt.entity.param.RspTest;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;

@RestController
@RequestMapping("test")
@Api(value = "token", tags = { "1.0,用于测试api是可以正常发起请求" },description="test")
public class TestController {

	//private final Logger log = LoggerFactory.getLogger(ApiTokenController.class);

	/**
	 * test
	 * 
	 * @return
	 */
	@ApiOperation(value="统一开发平台文档参考实例,点击test/test展开查看接口详情,切换Model和Example value切换查看入参和返回参数例子，点击try it out 在线测试")
	@ApiResponses(value = {
	            @ApiResponse(code = 200, message = "Successful — 请求已完成"),
	            @ApiResponse(code = 400, message = "请求中有语法问题，或不能满足请求"),
	            @ApiResponse(code = 401, message = "未授权客户机访问数据"),
	            @ApiResponse(code = 404, message = "服务器找不到给定的资源；文档不存在"),
	            @ApiResponse(code = 500, message = "服务器不能完成请求")}
	    )
	@RequestMapping(value = "/test", method = RequestMethod.POST)
	public RspTest test(@RequestBody RqTest params, BindingResult result) {
		RspTest jsonObject = new RspTest();
		jsonObject.setCode(1);
		jsonObject.setMsg("ok");
		return jsonObject;
	}
}
